﻿using System;
using System.Collections.Generic;
using System.Data;
using DBAccessLibrary.Model;
using DataAccess;
using System.Windows.Media;

namespace DBAccessLibrary.Interface
{
    public interface IGrammar
    {
        string AddColumn(FieldEntity filed);
        IEnumerable<string> EditColumn(FieldEntity filed);
        IEnumerable<string> RemoveColumn(FieldEntity field);
        IEnumerable<string> EditPrimary(TableEntity table);

        string SelectTop(TableEntity table, int count);
        string SelectAll(TableEntity table);
        string GetChTableSql { get; }
        string IsExistChTableSql{get;}
        string AppendTabText(string text);
        string GetErrorInfo(string errorMsg);
        string GetProcParamInfo(ProcEntity entity);
        string GetCreateInfo(DBType targetType, TableEntity entity);

       
        bool GetExecProcInfo(string sql, out string procName, out List<DBParam> paramlist);


        string GetDataSetToInsertSql(string sql, DataSet ds, Func<string, bool?> dbTypeAction, out string tableName);
        string GetPageingSql(string sql, decimal index, decimal count);

        void SaveChange(TableEntity table, IList<FieldEntity> newList, Action<string, Color> WriteLog, Func<string, bool> showMsg);
        Dictionary<string, Dictionary<string, object>> SubmitDataChange(DataSet ds, string tableName, string where);
    }

    internal interface ILocalGrammar
    {
        DatabaseType GetConnectionStr(out string connectStr);
    }
}
